Skip to content

Quack Patch enhancements#1763

Open
sig-abyreddy wants to merge 3 commits into
masterfrom
IDETECT-5121
Open

Quack Patch enhancements#1763
sig-abyreddy wants to merge 3 commits into
masterfrom
IDETECT-5121

Conversation

@sig-abyreddy
Copy link
Copy Markdown
Contributor

Description

Changes,

  • Changing the default output path of Quack Patch feature to runs directory
  • Added conditional around quack patch output director validation
  • Include quack patch output directory as part of diagnostic zip, if enabled

Github Issues

IDETECT-5121, IDETECT-5140

@sig-abyreddy sig-abyreddy self-assigned this May 14, 2026
@sig-abyreddy sig-abyreddy marked this pull request as draft May 14, 2026 13:10
Comment on lines +142 to +156
if (propertyConfiguration.getValueOrDefault(DetectProperties.DETECT_QUACK_PATCH_ENABLED)) {
String quackPatchOutputDirPath = propertyConfiguration.getValueOrDefault(DetectProperties.DETECT_QUACK_PATCH_OUTPUT);
// If quack patch output path is customized, then explicitly include it in the diagnostic zip. Otherwise, default behaviour will automatically pack it.
if (!quackPatchOutputDirPath.isEmpty()) {
quackPatchOutputDirPath = quackPatchOutputDirPath + File.separator + QUACKPATCH_SUBDIRECTORY_NAME;
logger.info("Adding quack patch output dir {} to the diagnostic zip.", quackPatchOutputDirPath);
// Copy directory quackPatchOutputDirPath to directoryManager.getRunsOutputDirectory()
try {
FileUtils.copyDirectory(new File(quackPatchOutputDirPath), new File(directoryManager.getScanOutputDirectory().getAbsolutePath() + File.separator + QUACKPATCH_SUBDIRECTORY_NAME));
} catch (IOException e) {
logger.error("Failed to copy quack patch output directory to runs directory. Error: {}", e.getMessage());
return false;
}
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If quack patch output path is not set, output will be written to runs/<timestamp-dir>/scan folder and diagnostics will have that information by default. If the output path is customized, then copying that directory into runs/<timestamp-dir>/scan folder so that diagnostics process can pick it up as default.

Note: Diagnostics archive process was adding the files based on its path. If the target file is outside runs dir context, compress logic is trying to add it as a relative path (e.g. runs/../../quack-patch/***). Copying quack-patch files into scan would keep the behaviour consistent.

private boolean createZip() {
// If quack patch is enabled, then add quack patch output directory to the zip
if (propertyConfiguration.getValueOrDefault(DetectProperties.DETECT_QUACK_PATCH_ENABLED)) {
String quackPatchOutputDirPath = propertyConfiguration.getValueOrDefault(DetectProperties.DETECT_QUACK_PATCH_OUTPUT);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to use the helper function (getQuackPatchOutputDirectory from detectConfigurationFactory) to get the quack patch output path here due to missing config context. Hence, the duplication of code.

@sig-abyreddy sig-abyreddy marked this pull request as ready for review May 15, 2026 06:43
@sig-abyreddy sig-abyreddy requested review from dterrybd and shantyk May 15, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant